package com.shensi.adminCollect.service.system.impl;


import com.shensi.adminCollect.domain.system.SysStationUser;
import com.shensi.adminCollect.mapper.system.SysStationUserMapper;
import com.shensi.adminCollect.service.system.ISysStationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 油站信息Service业务层处理
 * 
 * @author qujia
 * @date 2020-12-08
 */


@Service
public class SysStationUserServiceImpl implements ISysStationUserService
{
    @Autowired
    private SysStationUserMapper sysStationUserMapper;

    /**
     * 查询油站信息
     *
     * @param stationId 油站信息ID
     * @return 油企信息
     */
    public SysStationUser selectSysStationUserById(Long stationId){
        return sysStationUserMapper.selectSysStationUserById(stationId);
    }

    /**
     * 查询油站信息列表
     *
     * @param station 油站信息
     * @return 油站信息集合
     */
    public List<SysStationUser> selectSysStationUserList( SysStationUser station){
        return sysStationUserMapper.selectSysStationUserList(station);
    }

    /**
     * 查询油站id的集合通过油企
     *
     * @param enterpriseId 油企id信息
     * @return 油站信息集合
     */
    public List<String> selectStationIdByEnterpriseId( Long enterpriseId){
        List<String> ids=new ArrayList<>();
        SysStationUser stationUser=new SysStationUser();
        stationUser.setEnterpriseId(enterpriseId);
        List<SysStationUser> stationUsers=sysStationUserMapper.selectSysStationUserList(stationUser);
        for(SysStationUser sysStationUser: stationUsers){
            ids.add(sysStationUser.getStationId()+"");
        }
        return ids;
    }

    /**
     * 新增油站信息
     *
     * @param station 油站信息
     * @return 结果
     */
    public int insertSysStationUser(SysStationUser station){
        return sysStationUserMapper.insertSysStationUser(station);
    }

    /**
     * 修改油站信息
     *
     * @param station 油企信息
     * @return 结果
     */
    public int updateSysStationUser(SysStationUser station){
        return sysStationUserMapper.updateSysStationUser(station);
    }

    /**
     * 删除油站信息
     *
     * @param stationId 油企信息ID
     * @return 结果
     */
    public int deleteSysStationUserById(Long stationId){
        return sysStationUserMapper.deleteSysStationUserById(stationId);
    }

    /**
     * 批量删除油站信息
     *
     * @param stationIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteSysStationUserByIds(Long[] stationIds){
        return sysStationUserMapper.deleteSysStationUserByIds(stationIds);
    }
}
